package dukeCE.InsightTracker;



import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;

public class ShowMessage extends Activity{
	
	
	private String la="",lo="";
	private Button LocaBt;
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.showmessage);
        
        EditText authorEt=(EditText)findViewById(R.id.editText1);
        EditText topicEt=(EditText)findViewById(R.id.editText2);
       
        EditText desEt=(EditText)findViewById(R.id.editText3);
        EditText cntEt=(EditText)findViewById(R.id.editText4);
        
        LocaBt=(Button)findViewById(R.id.button1);
        
 
        Bundle bune=this.getIntent().getExtras();
        
        
        authorEt.setText(bune.getString("KEY_USER"));
        topicEt.setText(bune.getString("KEY_TITLE"));

        cntEt.setText(bune.getString("KEY_CNT"));
        int showla=Integer.parseInt(bune.getString("KEY_SHOWL"));
        
//        bundle.putString("KEY_USER", (String)(topics.get(position)).get("user"));
//        bundle.putString("KEY_TITLE", (String)(topics.get(position)).get("title"));
//        bundle.putString("KEY_CNT", (String)(topics.get(position)).get("content"));
////        bundle.putString("KEY_CONT", (String)(topics.get(position)).get("des"));
////        bundle.putString("KEY_LON", (String)(topics.get(position)).get("user"));
//        bundle.putString("KEY_LON", (String)(topics.get(position)).get("longtitude"));
//        bundle.putString("KEY_LAT", (String)(topics.get(position)).get("latitude"));
//        bundle.putString("KEY_SHOWL", (String)(topics.get(position)).get("showl"));
        
        
        if(showla==0)
      	  
           LocaBt.setEnabled(false);
        else
        	LocaBt.setEnabled(true);
         lo=bune.getString("KEY_LON");
         la=bune.getString("KEY_LAT");
         Log.e("log_tag", "lo  "+lo+" "+"la "+la); 
         setListeners();
        
    }
    private void setListeners() 
    {
    	 
    		
    	LocaBt.setOnClickListener(gotomap);
    } 

    private Button.OnClickListener gotomap = new Button.OnClickListener()   
  	 {
  	 	 
  	 public void onClick(View v) 
       { 
    	   
    	            //Switch to map
    	           Intent intent = new Intent();
    	           intent.setClass(ShowMessage.this,ShowTmap.class);
    	           Bundle bundle = new Bundle();
    	           bundle.putString("KEY_LON", lo);
    	           bundle.putString("KEY_LAT", la);
    	           
    	           intent.putExtras(bundle);
    	           startActivity(intent);
    	         
             }  
  	 

  };
}
